<?php
/**
 * Style is an instance of CActiveRecord (sytem.db.ar). 
 *
 * CActiveRecord is the base class for classes representing relational data. 
 *
 * Eduow :  International system for education (http://www.eduow.com)
 * Copyright 2010, Nikolay Stoitsev
 *
 * Licensed under GNU General Public License version 2
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright     Copyright 2010
 * @link          http://eduow.com Eduow Project
 * @package       eduow
 * @subpackage    application.models
 * @inheritance   class Style >> CActiveRecord >> CModel >> CComponent
 * @implements    ArrayAccess, Traversable, IteratorAggregate
 * @since         Eduow v 0.0.4
 * @license       http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License version 2
 */

class Style extends CActiveRecord
{
	/**
	 * The followings are the available columns in table 'style':
	 * @var integer $id
	 * @var integer $user
	 * @var string $backgroundcolor
	 * @var string $backgroundimage
	 * @var string $backgroundrepeat
	 * @var string $fontfamily
	 * @var string $fontsize
	 * @var string $linkcolor
	 * @var string $linkcolor-hover
	 * @var string $contentbgcolor
	 * @var string $footerbgcolor
	 */

	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className=__CLASS__){
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName(){
		return 'style';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules(){
		return array(
			array('user', 'numerical', 'integerOnly'=>true),
			array('backgroundcolor, backgroundrepeat, linkcolor, linkcolorhover, contentbgcolor, footerbgcolor', 'length', 'max'=>8),
			array('backgroundimage', 'length', 'max'=>255),
			array('fontfamily', 'length', 'max'=>20),
			array('fontsize', 'length', 'max'=>10),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels(){
		return array(
			'id' => Yii::t('yii','Id'),
			'user' => Yii::t('yii','User'),
			'backgroundcolor' => Yii::t('yii','Background color'),
			'backgroundimage' => Yii::t('yii','Background image'),
			'backgroundrepeat' => Yii::t('yii','Background repeat'),
			'fontfamily' => Yii::t('yii','Font family'),
			'fontsize' => Yii::t('yii','Font size'),
			'linkcolor' => Yii::t('yii','Link color'),
			'linkcolor-hover' => Yii::t('yii','Link color hover'),
			'contentbgcolor' => Yii::t('yii','Content background color'),
			'footerbgcolor' => Yii::t('yii','Footer background color'),
		);
	}
}
